package com.flitsneak.designpatterns.creationalpatterns.factory.simplefactory;

/**
 * Author: flitsneak
 * Date: 2022/5/31 17:12
 * Description:早餐工厂
 */
public class TraditionalBreakfastShop {

    public static <T extends Breakfast> T makeBreakfast(Class<T> clazz) {
        Breakfast traditionalBreakfast = null;

        try {
            traditionalBreakfast = (Breakfast) Class.forName(clazz.getName()).getDeclaredConstructor().newInstance();
        } catch (Exception e) {
            System.out.println("没有此早餐熟练度！");
        }

        return (T) traditionalBreakfast;
    }
}
